define([
  'order!jquery',
  'views/Modal',
  'views/ModalForm',
  "hbs!template/subscribers/subscriber-modal",
  "hbs!template/subscribers/success-modal",
  'order!bootstrap_tooltip',
  'order!bootstrap_popover'
], function($, Modal, ModalForm, template, successTemplate){

  var SubscribersModal = ModalForm.extend({
    template: template,
    
    initialize: function() {
      console.log("Subscribers form modal view");
      console.log(this.model);
      Modal.prototype.initialize.call(this);
    },
    
    renderContain: function() {
      $(this.el).html(this.template(this.model.toJSON()));
      this.$('[rel="popover"]').popover();
    },
    
    save: function(){
      this.model.save(this.getObjectFromForm(this.$("form")));
    },
    
    showSuccessMessage: function() {
      var modal = new Modal({template: successTemplate});
      modal.render();
    }

  });

  return SubscribersModal;
});